package org.jgs1904.test;

/**
 * @author: 默苍璃
 * @date: 2022-09-08 16:18
 */
public class IfElse {
    public static void main(String[] args) {
        int a = 8;

        if (a > 6) {
            System.out.println("6666");
        }
        {
            System.out.println("888");
        }

        //浮点型判断
        double x = 1 - 9.0 / 10;
        System.out.println(x);
        if (x == 0.1) {
            System.out.println("x is 0.1");
        } else {
            System.out.println("x is NOT 0.1");
        }

        if (Math.abs(x - 0.1) < 0.00001) {
            System.out.println("x is 0.1");
        } else {
            System.out.println("x is NOT 0.1");
        }

        System.out.println("_______________________________________判断引用类型_______________________________________");
        //判断引用类型
        String s1 = "hello";
        String s2 = "HELLO".toLowerCase();
        System.out.println(s1);
        System.out.println(s2);
        if (s1 == s2) {
            System.out.println("s1 == s2");
        } else {
            System.out.println("s1 != s2");
        }
        if (s1.equals(s2)) {
            System.out.println("s1 equals s2");
        } else {
            System.out.println("s1 not equals s2");
        }

    }
}
